﻿using Newtonsoft.Json;
using Pay.Core;
using Pay.TO;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Text;

namespace Pay.DTO {

    /// <summary>
    /// 社区帖子表 mc_Article
    /// </summary>
    [Serializable]
    [JsonObject(MemberSerialization.OptOut)]
    public class article_dto {
        /// <summary>
        /// 帖子Id
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 用户Id
        /// </summary>
        public long merchant_id { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string title { get; set; }

        /// <summary>
        /// 图片Url
        /// </summary>
        public string img_url { get; set; }

        /// <summary>
        /// 帖子内容
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 状态（枚举）0已删除 1正常
        /// </summary>
        public ArticleStatus status { get; set; }

        /// <summary>
        /// 是否置顶 0未置顶 1已置顶
        /// </summary>
        public bool is_top { get; set; }

        /// <summary>
        /// 是否加精品栏 0否 1是
        /// </summary>
        public bool is_highlight { get; set; }

        /// <summary>
        /// 回复数
        /// </summary>
        public int reply_num { get; set; }

        /// <summary>
        /// 点击数
        /// </summary>
        public int click_num { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime create_time { get; set; }

        /// <summary>
        /// 商户
        /// </summary>
        public merchant_dto merchant { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime update_time { get; set; }
        /// <summary>
        /// 0 帖子 2 帮助中心
        /// </summary>
        public int type { get; set; }

        /// <summary>
        /// 帖子回复表：mc_ReplyArticle
        /// </summary>
        public List<reply_article_dto> reply_articles { get; set; }
    }

    /// <summary>
    /// 社区帖子回复表 mc_ReplyArticle
    /// </summary>
    [Serializable]
    [JsonObject(MemberSerialization.OptOut)]
    public class reply_article_dto {
        /// <summary>
        /// 回复帖子Id
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 回复帖子内容
        /// </summary>
        public string reply_content { get; set; }

        /// <summary>
        /// 帖子Id
        /// </summary>
        public long article_id { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        public long merchant_id { get; set; }

        /// <summary>
        /// 状态（枚举）0已删除 1正常
        /// </summary>
        public ArticleStatus status { get; set; }

        /// <summary>
        /// 回帖时间
        /// </summary>
        public DateTime create_time { get; set; }

        /// <summary>
        /// 商户
        /// </summary>
        public merchant_dto merchant { get; set; }


    }

    /// <summary>
    /// 文章 置顶/装填/加精
    /// </summary>
    public class article_status {
        /// <summary>
        /// 文章id
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 状态（枚举）
        /// </summary>
        public ArticleStatus status { get; set; }

        /// <summary>
        /// 是否置顶 0未置顶 1已置顶
        /// </summary>
        public bool is_top { get; set; }

        /// <summary>
        /// 是否加精品栏 0否 1是
        /// </summary>
        public bool is_highlight { get; set; }
    }

    /// <summary>
    /// App端文章
    /// </summary>
    public class article_dto_ex {
        /// <summary>
        /// 文章id
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string title { get; set; }

        /// <summary>
        ///  用户头像
        /// </summary>
        public string photo { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 帖子内容
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime create_time { get; set; }

        /// <summary>
        /// 回复数
        /// </summary>
        public int reply_num { get; set; }

        /// <summary>
        /// 点击数
        /// </summary>
        public int click_num { get; set; }
    }

    /// <summary>
    /// App发布文章
    /// </summary>
    public class article_model {
        /// <summary>
        /// 标题
        /// </summary>
        [Required(ErrorMessage ="请填写标题"),MaxLength(50,ErrorMessage ="标题长度不能超过50字符")]
        public string title { get; set; }

        /// <summary>
        /// 帖子内容
        /// </summary>
        [Required(ErrorMessage = "请填写内容"), MaxLength(500, ErrorMessage = "内容长度不能超过500字符")]
        public string description { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        [JsonIgnore]
        public long merchant_id { get; set; }

    }

    /// <summary>
    /// app回帖
    /// </summary>
    public class reply_article_ex {

        /// <summary>
        /// 回复帖子Id
        /// </summary>
        public long id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 用户头像
        /// </summary>
        public string photo { get; set; }

        /// <summary>
        /// 回复帖子内容
        /// </summary>
        public string reply_content { get; set; }

        /// <summary>
        /// 回帖时间
        /// </summary>
        public DateTime create_time { get; set; }

        /// <summary>
        /// 是否能删除
        /// </summary>
        public bool is_delete { get; set; }

        /// <summary>
        /// 用户id
        /// </summary>
        [JsonIgnore]
        public long merchant_id { get; set; }

    }

    /// <summary>
    /// App回帖
    /// </summary>
    public class reply_article_model {

        /// <summary>
        /// 帖子Id
        /// </summary>
        public long article_id { get; set; }

        /// <summary>
        /// 回复帖子内容
        /// </summary>
        public string reply_content { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        [JsonIgnore]
        public long merchant_id { get; set; }

    }
}
